package com.webull.information.center.carwler.common.util;

import org.apache.commons.collections.bidimap.DualHashBidiMap;

import com.webull.information.center.carwler.common.model.BranchNews;
import com.webull.information.client.model.parm.NewsRelType;

/**
 * util
 */
public class BranchNewsUtil {
    private static final DualHashBidiMap cc = new DualHashBidiMap();

    static {
        cc.put(NewsRelType.ticker, BranchNews.TargetType.ticker);
        cc.put(NewsRelType.futureCategory, BranchNews.TargetType.futureGroup);
        cc.put(NewsRelType.currency, BranchNews.TargetType.currency);
        cc.put(NewsRelType.associate, BranchNews.TargetType.associate);
    }

    public static Integer genBranchTargetType(NewsRelType type) {
        return (Integer) cc.get(type);
    }

    public static NewsRelType genNewsRelType(Integer type) {
        return (NewsRelType) cc.inverseBidiMap().getOrDefault(type, NewsRelType.homePage);
    }

}
